package com.ruoyi.shopping.domain;

import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.constant.DicConstants;
import com.ruoyi.common.utils.DateUtils;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.ruoyi.common.core.domain.BaseEntity;

/**
 * 优惠券领取对象 jy_mall_coupons_member
 *
 * @author ruoyi
 * @date 2022-06-27
 */
@ApiModel
@Data
public class MallCouponsMember extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 主键 */
    @ApiModelProperty(value = "${comment}")
    private Long id;

    /** 优惠劵id */
    @Excel(name = "优惠劵id")
    @ApiModelProperty(value = "优惠劵id")
    private Long couponId;

    /** 领取人id */
    @Excel(name = "领取人id")
    @ApiModelProperty(value = "领取人id")
    private Long memberId;

    /** 领取人头像 */
    @Excel(name = "领取人头像")
    @ApiModelProperty(value = "领取人头像")
    private String memberPhoto;

    /** 领取人昵称 */
    @Excel(name = "领取人昵称")
    @ApiModelProperty(value = "领取人昵称")
    private String memberNickname;

    /** 优惠劵名称 */
    @Excel(name = "优惠劵名称")
    @ApiModelProperty(value = "优惠劵名称")
    private String couponName;

    /** 优惠劵金额 */
    @Excel(name = "优惠劵金额")
    @ApiModelProperty(value = "优惠劵金额")
    private BigDecimal money;

    /** 满多少远可用 */
    @Excel(name = "满多少远可用")
    @ApiModelProperty(value = "满多少远可用")
    private BigDecimal minPrice;

    /** 是否新人券 */
    @Excel(name = "是否新人券")
    @ApiModelProperty(value = "是否新人券")
    private String newUserState;

    /** 类型 */
    @Excel(name = "类型")
    @ApiModelProperty(value = "类型")
    private String couponType;

    /** 关联的分类 */
    @Excel(name = "关联的分类")
    @ApiModelProperty(value = "关联的分类")
    private String primaryKey;

    /** 是否一级分类 */
    @Excel(name = "是否一级分类")
    @ApiModelProperty(value = "是否一级分类")
    private String isFirstClassify;

    /** 分类Id */
    @Excel(name = "分类Id")
    @ApiModelProperty(value = "分类Id")
    private Long classifyId;

    /** 使用状态 */
    @Excel(name = "使用状态")
    @ApiModelProperty(value = "使用状态")
    private String useState;

    /** 是否可用状态 */
    @Excel(name = "是否可用状态")
    @ApiModelProperty(value = "是否可用状态")
    private String canUseState;

    /** 使用时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "使用时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "使用时间")
    private Date useTime;

    /** 可使用时间范围开始时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "可使用时间范围开始时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "可使用时间范围开始时间")
    private Date useStartTime;

    /** 可使用时间范围结束时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "可使用时间范围结束时间", width = 30, dateFormat = "yyyy-MM-dd")
    @ApiModelProperty(value = "可使用时间范围结束时间")
    private Date useEndTime;

    /** 获取类型 */
    @Excel(name = "获取类型")
    @ApiModelProperty(value = "获取类型")
    private String receiveType;

    /** 兑换码 */
    @Excel(name = "兑换码")
    @ApiModelProperty(value = "兑换码")
    private String cdkey;

    /** 赠送人id */
    @Excel(name = "赠送人id")
    @ApiModelProperty(value = "赠送人id")
    private Long giveUserId;

    private transient String specsId;
    private transient String goodsId = "";
    private transient String classifyIdStr = "";


    public String getSpecsId() {
        return specsId;
    }

    public void setSpecsId(String specsId) {
        this.specsId = specsId;
    }

    public void setId(Long id)
    {
        this.id = id;
    }

    public Long getId()
    {
        return id;
    }
    public void setCouponId(Long couponId)
    {
        this.couponId = couponId;
    }

    public Long getCouponId()
    {
        return couponId;
    }
    public void setMemberId(Long memberId)
    {
        this.memberId = memberId;
    }

    public Long getMemberId()
    {
        return memberId;
    }
    public void setMemberPhoto(String memberPhoto)
    {
        this.memberPhoto = memberPhoto;
    }

    public String getMemberPhoto()
    {
        return memberPhoto;
    }
    public void setMemberNickname(String memberNickname)
    {
        this.memberNickname = memberNickname;
    }

    public String getMemberNickname()
    {
        return memberNickname;
    }
    public void setCouponName(String couponName)
    {
        this.couponName = couponName;
    }

    public String getCouponName()
    {
        return couponName;
    }
    public void setMoney(BigDecimal money)
    {
        this.money = money;
    }

    public BigDecimal getMoney()
    {
        return money;
    }
    public void setMinPrice(BigDecimal minPrice)
    {
        this.minPrice = minPrice;
    }

    public BigDecimal getMinPrice()
    {
        return minPrice;
    }
    public void setNewUserState(String newUserState)
    {
        this.newUserState = newUserState;
    }

    public String getNewUserState()
    {
        return newUserState;
    }
    public void setCouponType(String couponType)
    {
        this.couponType = couponType;
    }

    public String getCouponType()
    {
        return couponType;
    }
    public void setPrimaryKey(String primaryKey)
    {
        this.primaryKey = primaryKey;
    }

    public String getPrimaryKey()
    {
        return primaryKey;
    }
    public void setIsFirstClassify(String isFirstClassify)
    {
        this.isFirstClassify = isFirstClassify;
    }

    public String getIsFirstClassify()
    {
        return isFirstClassify;
    }
    public void setClassifyId(Long classifyId)
    {
        this.classifyId = classifyId;
    }

    public Long getClassifyId()
    {
        return classifyId;
    }
    public void setUseState(String useState)
    {
        this.useState = useState;
    }

    public String getUseState()
    {
        return useState;
    }
    public void setCanUseState(String canUseState)
    {
        this.canUseState = canUseState;
    }

    public String getCanUseState()
    {
        return canUseState;
    }
    public void setUseTime(Date useTime)
    {
        this.useTime = useTime;
    }

    public Date getUseTime()
    {
        return useTime;
    }
    public void setUseStartTime(Date useStartTime)
    {
        this.useStartTime = useStartTime;
    }

    public Date getUseStartTime()
    {
        return useStartTime;
    }
    public void setUseEndTime(Date useEndTime)
    {
        this.useEndTime = useEndTime;
    }

    public Date getUseEndTime()
    {
        return useEndTime;
    }
    public void setReceiveType(String receiveType)
    {
        this.receiveType = receiveType;
    }

    public String getReceiveType()
    {
        return receiveType;
    }
    public void setCdkey(String cdkey)
    {
        this.cdkey = cdkey;
    }

    public String getCdkey()
    {
        return cdkey;
    }
    public void setGiveUserId(Long giveUserId)
    {
        this.giveUserId = giveUserId;
    }

    public Long getGiveUserId()
    {
        return giveUserId;
    }

    public MallCouponsMember(){}
    public MallCouponsMember(MallCoupons coupons){
        this.couponId=coupons.getId();
        this.couponName = coupons.getCouponName();
        this.couponType = coupons.getCouponType();
        this.money = coupons.getMoney();
        this.minPrice = coupons.getMinPrice();
        this.newUserState = coupons.getNewUserState();
        this.couponType = coupons.getCouponType();
        this.primaryKey = coupons.getPrimaryKey();
        this.canUseState = DicConstants.SYS_Y.getCode();
        this.useState = "N";
        if(DicConstants.SYS_Y.getCode().equals(coupons.getFixedTimeState())){
            this.useStartTime = new Date();
            this.useEndTime = DateUtils.addDate(new Date(),coupons.getValidDay());
        }else{
            this.useStartTime = coupons.getUseStartTime();
            this.useEndTime = coupons.getUseEndTime();
        }


    }
    @Override
    public String toString() {
        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
            .append("id", getId())
            .append("couponId", getCouponId())
            .append("memberId", getMemberId())
            .append("memberPhoto", getMemberPhoto())
            .append("memberNickname", getMemberNickname())
            .append("couponName", getCouponName())
            .append("money", getMoney())
            .append("minPrice", getMinPrice())
            .append("newUserState", getNewUserState())
            .append("couponType", getCouponType())
            .append("primaryKey", getPrimaryKey())
            .append("isFirstClassify", getIsFirstClassify())
            .append("classifyId", getClassifyId())
            .append("useState", getUseState())
            .append("canUseState", getCanUseState())
            .append("useTime", getUseTime())
            .append("useStartTime", getUseStartTime())
            .append("useEndTime", getUseEndTime())
            .append("receiveType", getReceiveType())
            .append("cdkey", getCdkey())
            .append("giveUserId", getGiveUserId())
            .append("delState", getDelState())
            .append("delUser", getDelUser())
            .append("delType", getDelType())
            .append("delTime", getDelTime())
            .append("createBy", getCreateBy())
            .append("createType", getCreateType())
            .append("createTime", getCreateTime())
            .append("updateBy", getUpdateBy())
            .append("updateType", getUpdateType())
            .append("updateTime", getUpdateTime())
            .toString();
    }
}
